<fieldset>
    <legend>Quá trình đào tạo</legend>
        <table class="responsive table">
            <thead>
                        <tr>
                            <th>STT</th>
                            <th>Loại hình</th>
                            <th>Tên bằng cấp</th>
                            <th>Tố nghiệp loại</th>
                            <th>Đơn vị cấp bằng</th>
                            <th>Ngày cấp</th>
                            <th>Thao tác</th>
                        </tr>
                    </thead>
                    <tbody id="education_background_list">
                    </tbody>

        </table>
        <table>
            <tr>
                <th><?php echo $staff_education_background_form['education_type']->renderLabel(null, array("class"=>"form-label"));  ?></th>
                <td><?php echo $staff_education_background_form['education_type']->render(array("staff_education_background_education_type" => "education_type", "class" => "text" ));  ?></td>
            </tr>
            <tr>
                <th><?php echo $staff_education_background_form['education_background_id']->renderLabel(null, array("class"=>"form-label"));  ?></th>
                <td><?php echo $staff_education_background_form['education_background_id']->render(array("id" => "staff_education_background_education_background_id", "class" => "text" ));  ?></td>
            </tr>
            <tr>
                <th><?php echo $staff_education_background_form['grade']->renderLabel(null, array("class"=>"form-label"));  ?></th>
                <td><?php echo $staff_education_background_form['grade']->render(array("id" => "staff_education_background_grade", "class" => "text" ));  ?></td>
            </tr>
            <tr>
                <th><?php echo $staff_education_background_form['issue_date']->renderLabel(null, array("class"=>"form-label"));  ?></th>
                <td><?php echo $staff_education_background_form['issue_date']->render(array("id" => "staff_education_background_issue_date", "class" => "text datepicker" ));  ?></td>
            </tr>
            <tr>
                <th><?php echo $staff_education_background_form['issue_establishment']->renderLabel(null, array("class"=>"form-label"));  ?></th>
                <td><?php echo $staff_education_background_form['issue_establishment']->render(array("id" => "staff_education_background_issue_establishment", "class" => "text" ));  ?></td>
            </tr>
        </table>
        <button class="btn btn-info" type="button" href="#" onclick="add_education_backgroun()">Thêm</button>
</fieldset>
<script>
    $(document).ready(function() {
        load_education_backgrounds();
    });

    function load_education_backgrounds()
    {
        html = '';
        <?php $count = 0 ?>
        <?php foreach ($staff_education_backgrounds as $staff_education_background) : ?>
            <?php $count += 1 ?>
            html = html + '<tr><td>' + '<?php echo $count ?>' + '</td><td>' +
                '<?php echo $staff_education_background->Education->getEducationTypeName() ?>' + '</td><td>'+
                '<?php echo $staff_education_background->Education->name ?>' + '</td><td>'+
                '<?php echo $staff_education_background->grade ?>' + '</td><td>'+
                '<?php echo $staff_education_background->issue_establishment ?>' + '</td><td>'+
                '<?php echo $staff_education_background->issue_date ?>' + '</td><td>'+
                '<div class="controls center">' +
                "<a href='#'" + "title='Remove task'"+ "class='tip'>"+ "<span onClick='remove_url(<?php echo $staff_education_background->staff_id ?>, <?php echo $staff_education_background->education_background_id ?>)' class='icon12 icomoon-icon-remove'>"+"</span>"+"</a>"+"</div>"+"</td>"+"</tr>";
        <?php endforeach ?>
        $('#education_background_list').html(html);
    }

    function add_education_backgroun()
    {
        $.post("<?php echo url_for('@staff_add_education_background') ?>",
                {
                    staff_id: '<?php echo $staff->id ?>',
                    education_background_id: $('#staff_education_background_education_background_id').val(),
                    grade: $('#staff_education_background_grade').val(),
                    description: $('#staff_event_description').val(),
                    issue_date: $('#staff_education_background_issue_date').val(),
                    issue_establishment: $('#staff_education_background_issue_establishment').val()
                }, function(data) {
                    if (data != 'error')
                        $('#education_background_list').html(data);
                    else
                        alert('Bạn đã tham gia tổ chức xã hội này.')
                }
        );
    }
</script>
